class Solution {
public:
    int numOfSubarrays(vector<int>& arr, int k, int threshold) {
        threshold*=k;
        int sum=0;
        int ans=0;
        for(int i=0;i<k;i++)
        {
            sum+=arr[i];
        }
        if(sum>=threshold)
            ans++;
        for(int i=0;i<arr.size()-k;i++)
        {
            sum-=arr[i];
            sum+=arr[i+k];
            if(sum>=threshold)
                ans++;
        }
        return ans;

    }
};